In questo lavoro andr?o ad analizzare i film e i videogiochi pubblicati dal 1970 al 2020 e si analizzeranno i generi più popolari, provando ad analizzare se ci sono delle analogie.
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objs as go
import warnings
warnings.filterwarnings("ignore")
df_vg = pd.read_csv("proj/vgsales-12-4-2019.csv")
df_mv = pd.read_csv("proj/IMDb movies.csv")
Di seguito ecco degli esempi dei 2 dataset che verranno utilizzati.
df_vg_noMultiple = df_vg.drop_duplicates(subset=['Name', 'Year'], keep='first')
df_mv = df_mv[df_mv.year != "TV Movie 2019"]
print("FILM")
display(df_mv.head(5))
print("VIDEO GIOCHI")
display(df_vg_noMultiple.head(5))
FILM
| imdb_title_id | title | original_title | year | date_published | genre | duration | country | language | director | ... | actors | description | avg_vote | votes | budget | usa_gross_income | worlwide_gross_income | metascore | reviews_from_users | reviews_from_critics | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | tt0000009 | Miss Jerry | Miss Jerry | 1894 | 1894-10-09 | Romance | 45 | USA | None | Alexander Black | ... | Blanche Bayliss, William Courtenay, Chauncey D... | The adventures of a female reporter in the 1890s. | 5.9 | 154 | NaN | NaN | NaN | NaN | 1.0 | 2.0 |
| 1 | tt0000574 | The Story of the Kelly Gang | The Story of the Kelly Gang | 1906 | 1906-12-26 | Biography, Crime, Drama | 70 | Australia | None | Charles Tait | ... | Elizabeth Tait, John Tait, Norman Campbell, Be... | True story of notorious Australian outlaw Ned ... | 6.1 | 589 | $ 2250 | NaN | NaN | NaN | 7.0 | 7.0 |
| 2 | tt0001892 | Den sorte drøm | Den sorte drøm | 1911 | 1911-08-19 | Drama | 53 | Germany, Denmark | NaN | Urban Gad | ... | Asta Nielsen, Valdemar Psilander, Gunnar Helse... | Two men of high rank are both wooing the beaut... | 5.8 | 188 | NaN | NaN | NaN | NaN | 5.0 | 2.0 |
| 3 | tt0002101 | Cleopatra | Cleopatra | 1912 | 1912-11-13 | Drama, History | 100 | USA | English | Charles L. Gaskill | ... | Helen Gardner, Pearl Sindelar, Miss Fielding, ... | The fabled queen of Egypt's affair with Roman ... | 5.2 | 446 | $ 45000 | NaN | NaN | NaN | 25.0 | 3.0 |
| 4 | tt0002130 | L'Inferno | L'Inferno | 1911 | 1911-03-06 | Adventure, Drama, Fantasy | 68 | Italy | Italian | Francesco Bertolini, Adolfo Padovan | ... | Salvatore Papa, Arturo Pirovano, Giuseppe de L... | Loosely adapted from Dante's Divine Comedy and... | 7.0 | 2237 | NaN | NaN | NaN | NaN | 31.0 | 14.0 |
5 rows × 22 columns
VIDEO GIOCHI
| Rank | Name | basename | Genre | ESRB_Rating | Platform | Publisher | Developer | VGChartz_Score | Critic_Score | ... | NA_Sales | PAL_Sales | JP_Sales | Other_Sales | Year | Last_Update | url | status | Vgchartzscore | img_url | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | Wii Sports | wii-sports | Sports | E | Wii | Nintendo | Nintendo EAD | NaN | 7.7 | ... | NaN | NaN | NaN | NaN | 2006.0 | NaN | http://www.vgchartz.com/game/2667/wii-sports/?... | 1 | NaN | /games/boxart/full_2258645AmericaFrontccc.jpg |
| 1 | 2 | Super Mario Bros. | super-mario-bros | Platform | NaN | NES | Nintendo | Nintendo EAD | NaN | 10.0 | ... | NaN | NaN | NaN | NaN | 1985.0 | NaN | http://www.vgchartz.com/game/6455/super-mario-... | 1 | NaN | /games/boxart/8972270ccc.jpg |
| 2 | 3 | Mario Kart Wii | mario-kart-wii | Racing | E | Wii | Nintendo | Nintendo EAD | NaN | 8.2 | ... | NaN | NaN | NaN | NaN | 2008.0 | 11th Apr 18 | http://www.vgchartz.com/game/6968/mario-kart-w... | 1 | 8.7 | /games/boxart/full_8932480AmericaFrontccc.jpg |
| 3 | 4 | PlayerUnknown's Battlegrounds | playerunknowns-battlegrounds | Shooter | NaN | PC | PUBG Corporation | PUBG Corporation | NaN | NaN | ... | NaN | NaN | NaN | NaN | 2017.0 | 13th Nov 18 | http://www.vgchartz.com/game/215988/playerunkn... | 1 | NaN | /games/boxart/full_8052843AmericaFrontccc.jpg |
| 4 | 5 | Wii Sports Resort | wii-sports-resort | Sports | E | Wii | Nintendo | Nintendo EAD | NaN | 8.0 | ... | NaN | NaN | NaN | NaN | 2009.0 | NaN | http://www.vgchartz.com/game/24656/wii-sports-... | 1 | 8.8 | /games/boxart/full_7295041AmericaFrontccc.jpg |
5 rows × 23 columns
Le colonne che si andranno ad utilizzare più avanti sono:
-- title -- year -- genre -- avg_vote
-- Name -- Genre -- Year -- Critic_Score
I prossimi 3 dataset sono stati creati per analizzare l'andamento delle pubblicazioni nel corso degli anni dei film e dei videogiochi.
Il 3° grafico mostra, in colorato, quale tra film e videogiochi ha pubblicato di più in un dato anno.
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
vg_years_tmp = pd.Series(df_vg_noMultiple["Year"])
vg_years = pd.to_numeric(vg_years_tmp, errors='coerce', downcast='integer')
df_vg_years = vg_years.to_frame().groupby(["Year"]).size()
mv_years_tmp = pd.Series(df_mv["year"], name="mv_year")
mv_years = pd.to_numeric(mv_years_tmp, errors='coerce', downcast='integer')
df_mv_years = mv_years.to_frame().groupby(["mv_year"]).size()
vg_minYear = int(min(df_vg_noMultiple["Year"]))
vg_maxYear = int(max(df_vg_noMultiple["Year"]))
years = pd.Series(df_mv["year"])
intYears = pd.to_numeric(years, errors ='coerce', downcast='integer')
mv_minYear = int(min(intYears))
mv_maxYear = int(max(intYears))
minCommonYear = vg_minYear
maxCommonYear = vg_maxYear
if (minCommonYear < mv_minYear):
minCommonYear = mv_minYear
if (maxCommonYear > mv_maxYear):
maxCommonYear = mv_maxYear
print(f"Anni in comune: dal {minCommonYear} al {maxCommonYear}")
df_CommonYears = pd.DataFrame(index=range(minCommonYear, maxCommonYear+1), columns=["vg_years", "mv_years"])
df_CommonYears["vg_years"] = df_vg_years
df_CommonYears["mv_years"] = df_mv_years
df_CommonYears = df_CommonYears.fillna(0)
df_CommonYears = df_CommonYears.astype(dtype ='int64')
df_CommonYears.columns = ['Video Games', 'Movies']
figBar = px.bar(df_CommonYears, x=df_CommonYears.index, y=["Video Games", "Movies"], title="Pubblicazioni di Videogiochi e Film per anno")
figBar.update_traces(texttemplate='%{value:.3s}', textposition='inside')
figBar.update_xaxes(title_text="Anno")
figBar.update_yaxes(title_text="Numero di pubblicazioni")
figBar.show()
figLine = px.line(df_CommonYears, x=df_CommonYears.index, y=["Video Games", "Movies"], title="Pubblicazioni di Videogiochi e Film per anno")
figLine.update_traces(mode="lines+markers")
figLine.update_xaxes(title_text="Anno")
figLine.update_yaxes(title_text="Numero di pubblicazioni")
figLine.show()
### COLORO LA LINEA CHE CHE RESTA SOPRA L'ALTRA ###
def inizioSopra(figura, color, colonna):
otherColumn = ""
if (colonna == "Movies"):
otherColumn = "Video Games"
else:
otherColumn = "Movies"
inizio = minCommonYear
fine = 0
i = minCommonYear+1
up = True
while (i <= maxCommonYear):
if (df_CommonYears.loc[i][colonna] >= df_CommonYears.loc[i][otherColumn]):
if (up):
i += 1
else:
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=3)))
up = True
inizio = i-1
i += 1
else:
if (up):
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
up = False
inizio = i-1
i += 1
else:
i += 1
if(df_CommonYears.loc[i-1][colonna] >= df_CommonYears.loc[i-1][otherColumn]):
if (up):
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
else:
fine = i-2
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
inizio = i-2
fine = i - 1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
else:
if (up):
fine = i-2
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
inizio = i-2
fine = i - 1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
else:
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
def inizioSotto(figura, color, colonna):
otherColumn = ""
if (colonna == "Movies"):
otherColumn = "Video Games"
else:
otherColumn = "Movies"
inizio = minCommonYear
fine = 0
i = minCommonYear + 1
down = True
while (i <= maxCommonYear):
if (df_CommonYears.loc[i][colonna] < df_CommonYears.loc[i][otherColumn]):
if (down):
i += 1
else:
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
down = True
inizio = i-1
i += 1
else:
if (down):
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
down = False
inizio = i-1
i += 1
else:
i += 1
if(df_CommonYears.loc[i-1][colonna] < df_CommonYears.loc[i-1][otherColumn]):
if (down):
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
else:
fine = i-2
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
inizio = i-2
fine = i - 1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
else:
if (down):
fine = i-2
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color='grey', width=2)))
inizio = i-2
fine = i - 1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
else:
fine = i-1
figura.add_trace(go.Scatter(x=df_CommonYears.index+(inizio-minCommonYear), y=df_CommonYears.loc[inizio:fine][colonna], mode='lines', line=dict(color=color, width=3)))
def settingColors(fig):
### MOVIES ###
color = "red"
### inizio ###
if (df_CommonYears.loc[minCommonYear]["Movies"] < df_CommonYears.loc[minCommonYear]["Video Games"]):
inizioSotto(fig, color, "Movies")
else:
inizioSopra(fig, color,"Movies")
### VIDEO GAMES ###
color = "blue"
### inizio ###
if (df_CommonYears.loc[minCommonYear]["Video Games"] < df_CommonYears.loc[minCommonYear]["Movies"]):
inizioSotto(fig, color, "Video Games")
else:
inizioSopra(fig, color,"Video Games")
figLine2 = go.Figure()
figLine2.update_traces(mode="lines+markers")
figLine2.update_xaxes(title_text="Anno")
figLine2.update_yaxes(title_text="Numero di pubblicazioni")
#figLine2.add_trace(go.Scatter(x=df_CommonYears.index, visible=False))
settingColors(figLine2)
figLine2.update_layout(showlegend=False, title="Evidenzio la linea superiore all'altra (pubblicazione maggiore)")
figLine2.show()
Anni in comune: dal 1970 al 2020
È possibile notare, grazie a questi grafici, che per molti anni i videogiochi non venivano pubblicati. Presumo per il fatto che la richiesta, vista la tecnologia comune di allora, era molto arretrata. A partire dall'inizio degli anni 90, la domanda di videogiochi è cresciuta, mentre quella di film è rimasta stabile, facendo sì che il numero di videogiochi pubblicati sia superiore a quello di film.
È interessante mostrare come l'andamento dei film è di un crescente stabile, mentre quello dei videogiochi è di una crescita molto instabile e variabile.
Nei prossimi grafici si analizzeranno i generi più pubblicati per ogni anno, per entrambi i dataset. Inizialmente si analizzeranno i 3 generi più pubblicati per ogni anno, poi il genere più pubblicato per ogni anno.
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', 15)
### Video Games Genres ###
df_vg_genre = df_vg_noMultiple.groupby(["Year", "Genre"]).size().to_frame().reset_index()
df_vg_genre.columns = ['Year', 'Genre', 'Count']
df_vg_genre['Year'] = df_vg_genre['Year'].astype(dtype ='int64')
df_vg_genre_noMisc = df_vg_genre[df_vg_genre.Genre != "Misc"]
### Movies genre ###
df_mv_genre = df_mv[["year", "genre"]]
df_mv_genre.columns = ['Year', 'Genre']
df_mv_genre['Genre'] = df_mv_genre['Genre'].str.split(",")
df_mv_genre = df_mv_genre.explode('Genre').reset_index(drop=True)
df_mv_genre['Genre'] = df_mv_genre['Genre'].str.strip()
df_mv_genre = df_mv_genre.groupby(["Year", "Genre"]).size().to_frame().reset_index()
df_mv_genre.columns = ['Year', 'Genre', 'Count']
df_mv_genre['Year'] = df_mv_genre['Year'].astype(dtype ='int64')
df_mv_genre = df_mv_genre[df_mv_genre.Year.between(minCommonYear, maxCommonYear)]
### linea dei top grigia e poi per colorato per ogni genere ###
def barTop(df, top, title):
df_top = df.sort_values(by=['Count'], ascending=False).groupby('Year').head(top)
fig = px.bar(df_top, x="Year", y="Count", color="Genre", title=title, text="Genre")
fig.update_xaxes(title_text="Anno")
fig.update_yaxes(title_text="Numero di pubblicazioni")
fig.update_layout(height=800)
fig.show()
num = 3
barTop(df_vg_genre, num, f"Top {num} generi di videogiochi per anno w/Misc")
barTop(df_vg_genre_noMisc, num, f"Top {num} generi di videogiochi per anno (No Misc)")
barTop(df_mv_genre, num, f"Top {num} generi di film per anno")
num = 1
barTop(df_vg_genre, num, f"Top {num} generi di videogiochi per anno w/Misc")
barTop(df_vg_genre_noMisc, num, f"Top {num} generi di videogiochi per anno (No Misc)")
barTop(df_mv_genre, num, f"Top {num} generi di film per anno")
Da notare che per i videogiochi vi sono i grafici che includono e che non includono il genere "Misc". Questo genere è un insieme di più generi non specificati, per questo, per avere una visione più chiara, è stato creato un grafico che non lo considera. Nei grafici a seguire, non verrà più consiferato il genere "Misc".
È interessante notare come, per i videogiochi, ci son più generi comparsi almeno una volta tra i 3 più pubblicati per ogni anno, rispetto ai film.
Si andrà ora ad analizzare l'andamento per ogni genere comparso almeno una volta in una top 3 paragonato all'andamento generale delle pubblicazioni generali.
from plotly.subplots import make_subplots
pd.set_option('display.max_rows', 50)
### TROVO TUTTI I GENERI DELLA TOP 3 ###
top = 3
### MOVIES ###
df_mv_genre_top = df_mv_genre.sort_values(by=['Count'], ascending=False).groupby('Year').head(top)
### RESET MOVIE GENERS ###
df_mv_genre = df_mv[["year", "genre"]]
df_mv_genre.columns = ['Year', 'Genre']
df_mv_genre['Genre'] = df_mv_genre['Genre'].str.split(",")
df_mv_genre = df_mv_genre.explode('Genre').reset_index(drop=True)
df_mv_genre['Genre'] = df_mv_genre['Genre'].str.strip()
df_mv_genre = df_mv_genre.groupby(["Year", "Genre"]).size().to_frame().reset_index()
df_mv_genre.columns = ['Year', 'Genre', 'Count']
df_mv_genre['Year'] = df_mv_genre['Year'].astype(dtype ='int64')
df_mv_genre = df_mv_genre[df_mv_genre.Year.between(minCommonYear, maxCommonYear)]
### PRENDO TUTTI I FILM CON I GENERI IN DF_MV_GENRE ###
df_mv_inTop = df_mv.loc[df_mv['genre'].str.contains('|'.join(df_mv_genre_top.Genre.unique()))]
df_mv_inTop['genre'] = df_mv_inTop['genre'].str.split(",")
df_mv_inTop = df_mv_inTop.explode('genre').reset_index(drop=True)
df_mv_inTop['genre'] = df_mv_inTop['genre'].str.strip()
df_mv_inTop = df_mv_inTop[['year', 'genre', 'title']]
df_mv_inTop.columns = ['Year', 'Genre', 'Title']
df_mv_inTop = df_mv_inTop.groupby(["Year", "Genre"]).size().to_frame().reset_index()
df_mv_inTop.columns = ['Year', 'Genre', 'Count']
df_mv_inTop['Year'] = df_mv_inTop['Year'].astype(dtype ='int64')
df_mv_inTop = df_mv_inTop[df_mv_inTop.Year.between(minCommonYear, maxCommonYear)]
print("FILM")
dict_mv = {}
for genre in df_mv_genre_top.Genre.unique():
dict_mv[genre] = df_mv_inTop[df_mv_inTop.Genre == genre].groupby('Year').sum().reset_index()
fig_mv= make_subplots(rows=1, cols=2)
for genre in dict_mv:
fig_mv.add_trace(go.Scatter(x=dict_mv[genre]['Year'], y=dict_mv[genre]['Count'], name=genre, mode="markers"), row=1, col=1)
fig_mv.update_layout(title="Andamento dei generi comparsi in almeno una top 3 dei film comparato con l'andamento totale dei film", height=800)
fig_mv.add_trace(go.Scatter(x=df_CommonYears.index, y=df_CommonYears["Movies"], mode='lines', name="Movies", line=dict(color="grey", width=2)), row=1, col=2)
fig_mv.update_xaxes(title_text="Anno")
fig_mv.update_yaxes(title_text="Pubblicazioni")
fig_mv.show()
for genre in dict_mv:
fig_mv2 = make_subplots(rows=1, cols=2)
for genre2 in dict_mv:
if (genre2 == genre):
fig_mv2.add_trace(go.Scatter(x=dict_mv[genre]['Year'], y=dict_mv[genre]['Count'], name=genre, mode="lines+markers", showlegend=True), row=1, col=1)
fig_mv2.update_layout(title="Andamento del genere "+genre2+" nei film comparato con l'andamento totale dei film", height=800)
tmp = px.scatter(dict_mv[genre], x="Year", y="Count", title="Andamento del genere "+genre2+" nei film con trandline", trendline="lowess", trendline_color_override="black")
tmp.update_xaxes(title_text="Anno")
tmp.update_yaxes(title_text="Pubblicazioni")
fig_mv2.add_trace(go.Scatter(x=df_CommonYears.index, y=df_CommonYears["Movies"], mode='lines', name="Movies", line=dict(color="grey", width=2)), row=1, col=2)
fig_mv2.update_xaxes(title_text="Anno")
fig_mv2.update_yaxes(title_text="Pubblicazioni")
fig_mv2.show()
tmp.show()
### VIDEO GAMES ###
### NO MISC ###
df_vg_genre_top = df_vg_genre_noMisc.sort_values(by=['Count'], ascending=False).groupby('Year').head(top)
df_vg_inTop = df_vg_noMultiple.loc[df_vg_noMultiple['Genre'].str.contains('|'.join(df_vg_genre_top.Genre.unique()))]
df_vg_inTop = df_vg_inTop[['Year', 'Genre', 'Name']]
df_vg_inTop = df_vg_inTop.groupby(["Year", "Genre"]).size().to_frame().reset_index()
df_vg_inTop.columns = ['Year', 'Genre', 'Count']
df_vg_inTop['Year'] = df_vg_inTop['Year'].astype(dtype ='int64')
df_vg_inTop = df_vg_inTop[df_vg_inTop.Year.between(minCommonYear, maxCommonYear)]
print("VIDEO GIOCHI")
dict_vg = {}
for genre in df_vg_genre_top.Genre.unique():
dict_vg[genre] = df_vg_inTop[df_vg_inTop.Genre == genre].groupby('Year').sum().reset_index()
fig_vg= make_subplots(rows=1, cols=2)
for genre in dict_vg:
fig_vg.add_trace(go.Scatter(x=dict_vg[genre]['Year'], y=dict_vg[genre]['Count'], name=genre, mode="markers"), row=1, col=1)
fig_vg.update_layout(title="Andamento dei generi comparsi in almeno una top 3 dei videogiochi comparato con l'andamento totale dei videogiochi", height=800)
fig_vg.add_trace(go.Scatter(x=df_CommonYears.index, y=df_CommonYears["Video Games"], mode='lines', name="Video Games", line=dict(color="grey", width=2)), row=1, col=2)
fig_vg.update_xaxes(title_text="Anno")
fig_vg.update_yaxes(title_text="Pubblicazioni")
fig_vg.show()
for genre in dict_vg:
fig_vg2 = make_subplots(rows=1, cols=2)
for genre2 in dict_vg:
if (genre2 == genre):
fig_vg2.add_trace(go.Scatter(x=dict_vg[genre]['Year'], y=dict_vg[genre]['Count'], name=genre, mode="lines+markers", showlegend=True), row=1, col=1)
fig_vg2.update_layout(title="Andamento del genere "+genre2+" nei videogiochi comparato con l'andamento totale dei videogiochi", height=800)
tmp = px.scatter(dict_vg[genre], x="Year", y="Count", title="Andamento del genere "+genre2+" nei video giochi con trandline", trendline="lowess", trendline_color_override="black")
tmp.update_xaxes(title_text="Anno")
tmp.update_yaxes(title_text="Pubblicazioni")
fig_vg2.add_trace(go.Scatter(x=df_CommonYears.index, y=df_CommonYears["Video Games"], mode='lines', name="Video Games", line=dict(color="grey", width=2)), row=1, col=2)
fig_vg2.update_xaxes(title_text="Anno")
fig_vg2.update_yaxes(title_text="Pubblicazioni")
fig_vg2.show()
tmp.show()
FILM
VIDEO GIOCHI
È curioso notare come l'andamento dei generi segua quello generale, con qualche piccola eccezione, mentre la trandline dei generi dei film è in crescita, mentre quella dei videogiochi è in decrescita dagli inizi degli anni 2000.
Si confronterà l'andamento dei generi simili tra loro, tra videogiochi e film. I generi coinvolti sono, per i videogiochi, Action, Shooter, Adventure e Action-Adventure, mentre per i film sono Action e Thriller.
Le pubblicazioni di questi generi viene sommato tra loro e poi confrontato.
dict_vg2 = {k: dict_vg[k] for k in ('Action', 'Shooter', 'Adventure', 'Action-Adventure')}
dict_mv2 = {k: dict_mv[k] for k in ('Action', 'Thriller')}
dict_vg3 = {}
for genre in dict_vg2:
for index, row in dict_vg2[genre].iterrows():
if row['Year'] in dict_vg3:
dict_vg3[row['Year']] += row['Count']
else:
dict_vg3[row['Year']] = row['Count']
dict_mv3 = {}
for genre in dict_mv2:
for index, row in dict_mv2[genre].iterrows():
if row['Year'] in dict_mv3:
dict_mv3[row['Year']] += row['Count']
else:
dict_mv3[row['Year']] = row['Count']
df_dictUnited = pd.DataFrame.from_dict(dict_mv3, orient='index', columns=['Movies'])
df_dictUnited['Video Games'] = pd.DataFrame.from_dict(dict_vg3, orient='index', columns=['Video Games'])
df_dictUnited = df_dictUnited.fillna(0)
df_dictUnited = df_dictUnited.astype(dtype ='int64')
fig_histogramUnited = px.histogram(df_dictUnited, x=df_dictUnited.index, y=df_dictUnited.columns, title="Andamento dei generi simili", barmode="overlay", opacity=0.55)
fig_histogramUnited.update_layout(xaxis_title="Anno", yaxis_title="Pubblicazioni")
fig_histogramUnited.show()
È possibile notare, grazie a questo grafico, che tra il 1980 e il 2009 vi è stata una crescita esponenziale dei generi videoludici, superando addirittura il numero di pubblicazioni di film. il calo delle pubblicazioni videoludiche dal 2010 in poi è probabilmente dato dal fatto che la pubblicazione di videogiochi è calata drasticamente, mentre quella di film è rimasta stabile (fino al 2020 per motivi dovuti al COVID-19)
Il prossimo grafico è lo stesso ma, invece di avere le pubblicazioni effettive, avere la percentuale di pubblicazioni rispetto al totale.
### UTILIZZO DF_COMMONYEARS PER IL MASSIMO DELLE PUBBLICAZIONI PER ANNO ###
df_dictUnitedAverage = df_dictUnited.copy()
df_dictUnitedAverage['Video Games'] = df_dictUnited['Video Games'].div(df_CommonYears['Video Games'])*100
df_dictUnitedAverage['Movies'] = df_dictUnited['Movies'].div(df_CommonYears['Movies'])*100
df_dictUnitedAverage.fillna(0, inplace=True)
fig_histogramAverage = px.histogram(df_dictUnitedAverage, x=df_dictUnitedAverage.index, y=df_dictUnitedAverage.columns, title="Andamento dei generi simili in percentuale all'andamento totale", barmode="overlay", opacity=0.55)
fig_histogramAverage.update_layout(xaxis_title="Anno", yaxis_title="Pubblicazioni")
fig_histogramAverage.show()
fig_histogramAverage = go.Figure()
fig_histogramAverage.add_trace(go.Bar(x=df_dictUnitedAverage.index, y=df_dictUnitedAverage['Video Games'], name="Video Games", marker_color="red"))
fig_histogramAverage.add_trace(go.Bar(x=df_dictUnitedAverage.index, y=df_dictUnitedAverage['Movies'], name="Movies", marker_color="blue"))
fig_histogramAverage.update_layout(title="Andamento dei generi simili in percentuale all'andamento totale", xaxis_title="Anno", yaxis_title="Pubblicazioni")
fig_histogramAverage.show()
A differenza di quello che si vedeva dai grafici precedenti, questi 2 grafici mostrano come, in percentuale al totale delle pubblicazioni, i videogiochi dei generi Action, Shooter, Adventure e Action-Adventure hanno avuto un andamento molto simile a quello dei film di genere Action e Thriller, con, però, un aumento all'inizio degli anni 80.
Quello che si andrà a vedere ora sono i film e videogiochi con la votazione tra il 9 e il 10 compresi e vedere se ci sono delle similitudini tra i generi.
df_vg_critics = df_vg_noMultiple[['Year', 'Name', 'Genre', 'Critic_Score']]
df_mv_critics = df_mv[['year', 'title', 'genre', 'avg_vote']]
df_vg_critics = df_vg_critics.sort_values(by=['Critic_Score'], ascending=False)
df_mv_critics = df_mv_critics.sort_values(by=['avg_vote'], ascending=False)
df_vg_critics = df_vg_critics.dropna()
df_vg_critics['Year'] = df_vg_critics['Year'].astype(dtype='int64')
df_vg_critics = df_vg_critics[df_vg_critics['Critic_Score'] >= 9]
df_mv_critics = df_mv_critics[df_mv_critics['avg_vote'] >= 9]
dict_vg_critics = {}
dict_mv_critics = {}
dict_mv_criticsNames = {}
dict_vg_criticsNames = {}
for index, row in df_vg_critics.iterrows():
if row['Genre'] in dict_vg:
if row['Genre'] in dict_vg_critics:
dict_vg_criticsNames[row['Genre']].append(row['Name'])
dict_vg_critics[row['Genre']] += 1
else:
dict_vg_criticsNames[row['Genre']] = [row['Name']]
dict_vg_critics[row['Genre']] = 1
for index, row in df_mv_critics.iterrows():
if row['genre'] in dict_mv:
if row['genre'] in dict_mv_critics:
dict_mv_criticsNames[row['genre']].append(row['title'])
dict_mv_critics[row['genre']] += 1
else:
dict_mv_criticsNames[row['genre']] = [row['title']]
dict_mv_critics[row['genre']] = 1
df_tmp = pd.DataFrame.from_dict(dict_vg_criticsNames, orient='index')
display(df_tmp)
df_tmp = pd.DataFrame.from_dict(dict_mv_criticsNames, orient='index')
display(df_tmp)
df_tmp = pd.DataFrame.from_dict(dict_vg_critics, orient='index')
display(df_tmp)
df_tmp = pd.DataFrame.from_dict(dict_mv_critics, orient='index')
display(df_tmp)
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Role-Playing | Final Fantasy II | Dragon Quest XI: Echoes of an Elusive Age | Chrono Cross | Final Fantasy VII | Chrono Trigger | Final Fantasy III (SNES) | Baldur's Gate II: Shadows of Amn | Mass Effect 2 | Super Mario RPG: Legend of the Seven Stars | South Park: The Fractured But Whole | Final Fantasy XII | Final Fantasy VIII | Star Wars: Knights of the Old Republic | Pokemon Red / Green / Blue Version | Mass Effect 2 | The Elder Scrolls V: Skyrim | The Elder Scrolls IV: Oblivion | Xenoblade Chronicles | Vagrant Story | Chrono Trigger | Fallout 2 | The Elder Scrolls IV: Oblivion | Final Fantasy IX | Mass Effect | Shin Megami Tensei: Persona 4 | Skies of Arcadia | Baldur's Gate | Persona 2: Innocent Sin | Pokemon Gold / Silver Version | Final Fantasy Chronicles | Final Fantasy III | Final Fantasy VI Advance | Paper Mario | Mass Effect | Demon's Souls | Secret of Mana | Mario & Luigi: Bowser's Inside Story | Ogre Battle 64: Person of Lordly Caliber | Golden Sun | Freedom Force | Panzer Dragoon Saga | Fire Emblem: Awakening | Dark Souls | Paper Mario: The Thousand-Year Door | Ogre Battle 64: Person of Lordly Caliber | Ogre Battle: The March of the Black Queen | Ogre Battle: The March of the Black Queen | Secret of Mana | Phantasy Star IV | Breath of Fire | Ultima Online | Jade Empire | Fallout 3 | Tactics Ogre: Let Us Cling Together | Paper Mario | Undertale | Diablo III | Disgaea 5 Complete | Fable II | Pokemon Sun/Moon | Final Fantasy Tactics: The War of the Lions | Final Fantasy X | None | None | None | None |
| Action | Final Fight | Red Dead Redemption: Undead Nightmare | Grand Theft Auto IV | Rockstar Games Double Pack: Grand Theft Auto I... | God of War (2018) | Grand Theft Auto V | Batman: Arkham City | Resident Evil 4 | Grand Theft Auto: Vice City | Ninja Gaiden Black | Red Dead Redemption | Uncharted 2: Among Thieves | Red Dead Redemption | Bayonetta 2 | Metal Gear Solid 2: Sons of Liberty | Grand Theft Auto III | Grand Theft Auto: San Andreas | Tom Clancy's Splinter Cell: Chaos Theory | Grand Theft Auto V | Viewtiful Joe | Resident Evil 3: Nemesis | Ninja Gaiden | Metal Gear Solid 3: Subsistence | Monster Hunter: World | Resident Evil 2 | God of War | Mark of the Ninja | God of War II | Uncharted 3: Drake's Deception | Tom Clancy's Splinter Cell | Dead Cells | Bayonetta 2 | Metal Gear Solid 4: Guns of the Patriots | Metal Gear Solid | Resident Evil 5: Gold Edition | Resident Evil - Code: Veronica | Resident Evil 4: Wii Edition | Mafia | Grand Theft Auto: San Andreas | Uncharted 4: A Thief's End | God of War III | Tom Clancy's Splinter Cell: Pandora Tomorrow | God of War Collection | Jet Grind Radio | Blast Corps | Assassin's Creed: Brotherhood | Horizon: Zero Dawn | Grand Theft Auto III | Devil May Cry | Grand Theft Auto: Liberty City Stories | Oddworld: Stranger's Wrath HD | Metal Gear Rising: Revengeance | The Binding of Isaac: Afterbirth+ | Grand Theft Auto: Vice City | Diablo III: Eternal Collection | Assassin's Creed II | Resident Evil 2 | Yoku's Island Express | Batman: Arkham Asylum | Metal Gear Solid 3: Snake Eater | escapeVektor: Chapter 1 | Resident Evil 2: Dual Shock Edition | None | None | None | None |
| Platform | Super Mario Bros. | Super Mario Odyssey | Super Mario Galaxy | Super Mario 64 | Super Mario Bros. Deluxe | Super Mario Galaxy 2 | Mega Man 2 | Super Mario 3D World | Super Mario Bros. 3 | LittleBigPlanet: Game of the Year Edition | Rayman Legends | Super Mario World: Super Mario Advance 2 | Braid | Klonoa 2: Lunatea's Veil | LittleBigPlanet | Celeste | Banjo-Tooie | Donkey Kong Country 2: Diddy's Kong Quest | Castlevania: Symphony of the Night | Banjo-Kazooie | Donkey Kong 64 | Ape Escape | Crash Bandicoot 3: Warped | Castlevania: Symphony of the Night | Super Mario Advance 4: Super Mario Bros. 3 | Super Meat Boy | Super Mario Sunshine | Conker's Bad Fur Day | New Super Mario Bros. | Spyro: Year of the Dragon | LittleBigPlanet 2 | NiGHTS into dreams... | Donkey Kong Country: Tropical Freeze | Ratchet & Clank: Up Your Arsenal | Donkey Kong Country | Sonic & Knuckles | Rayman | Super Mario 64 | Super Mario Land 2: 6 Golden Coins | Super Mario Bros. | Super Mario World 2: Yoshi's Island | Owlboy | Castlevania III: Dracula's Curse | Rayman 2: The Great Escape | LIMBO | Disney's Kim Possible 3: Team Possible | Jak and Daxter: The Precursor Legacy | Shovel Knight | Super Mario Land 2: 6 Golden Coins | TowerFall Ascension | Castlevania: Rondo of Blood | Donkey Kong Country | Castlevania Double Pack | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Adventure | The Legend of Zelda: A Link to the Past | The Legend of Zelda Collector's Edition | The Legend of Zelda: Ocarina of Time | The Legend of Zelda: A Link to the Past | The Legend of Zelda: The Wind Waker | The Legend of Zelda: A Link to the Past | The Legend of Zelda: Twilight Princess | Grand Theft Auto: Chinatown Wars | The Legend of Zelda: Majora's Mask | The Legend of Zelda: Link's Awakening DX | Okami | Grand Theft Auto IV: The Lost and Damned | The Legend of Zelda: Skyward Sword | The Legend of Zelda: Oracle of Ages | The Legend of Zelda: A Link Between Worlds | The Legend of Zelda: Oracle of Seasons | Eternal Darkness: Sanity's Requiem | Grim Fandango | The Legend of Zelda: Majora's Mask | L.A. Noire | Shadow of the Colossus | Legacy Of Kain: Soul Reaver | The Legend of Zelda: Phantom Hourglass | Gone Home | Metroid Fusion | The Legend of Zelda: Four Swords Anniversary E... | The Legend of Zelda | Prince of Persia: The Sands of Time | Grand Theft Auto IV: The Ballad of Gay Tony | Maniac Mansion: Day of the Tentacle | Grand Theft Auto: Episodes from Liberty City | Metroid II: Return of Samus | The ICO & Shadow of the Colossus Collection | Super Metroid | Grand Theft Auto: Episodes from Liberty City | Metal Gear Solid: The Essential Collection | The Legend of Zelda: Ocarina of Time / Master ... | Okami | Ceville | Sam & Max Hit the Road | Final Fantasy Adventure | Metal Gear Solid Integral | Moss | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Shooter | Fusion: Genesis | GoldenEye 007 | Portal 2 | Perfect Dark | The Orange Box | Half-Life 2 | Halo 2 | Call of Duty 4: Modern Warfare | Metroid Prime | BioShock | BioShock | Halo 3 | Halo: Combat Evolved | Half-Life | Call of Duty: Modern Warfare 2 | Unreal Tournament 2004 | Quake | Gears of War | Gears of War 2 | Counter-Strike: Source | Medal of Honor: Allied Assault | BioShock | Doom II | Thief: The Dark Project | Unreal Tournament | Halo: Reach | Medal of Honor | Quake III Arena | Metroid Prime 2: Echoes | Team Fortress 2 | Crysis | Syphon Filter | Deus Ex | Killzone 2 | Red Faction | TimeSplitters 2 | Half-Life 2: Episode Two | Gears of War 3 | Tom Clancy's Ghost Recon Advanced Warfighter | Geometry Wars: Retro Evolved 2 | Dead Space 2 | Rez HD | Killzone: Shadow Fall | Quake II | Magic Carpet | PixelJunk SideScroller | Wolfenstein II: The New Colossus | Metroid Prime 3: Corruption | Turok 2: Seeds of Evil | Gunstar Heroes | Sin and Punishment | Radiant Silvergun | Unreal Tournament | Star Fox 64 | Left 4 Dead 2 | Battlefield 1943 | Rez | Unreal Tournament 2003 | Battlefield 1942 | Metroid Prime: Trilogy | Age of Zombies | Medal of Honor: Frontline | Battlefield 2 | Portal | Battlefield: Bad Company 2 | Dead Space |
| Racing | Super Mario Kart | Gran Turismo | Gran Turismo 3: A-Spec | Mario Kart: Super Circuit | Grand Prix 3 | Burnout 3: Takedown | Mario Kart 8 Deluxe | Crazy Taxi | Crash Team Racing | Beetle Adventure Racing! | Forza Motorsport 3 | Forza Motorsport | Gran Turismo 2 | Wave Race 64 | Forza Horizon 4 | WipEout Pure | Mario Kart DS | Forza Motorsport 4 | WipEout HD Fury | Forza Motorsport 2 | R4: Ridge Racer Type 4 | Forza Horizon 3 | DiRT 3 | Burnout Paradise | Andretti Racing | Burnout Paradise | Ridge Racer | Burnout Revenge | Daytona USA | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Action-Adventure | The Legend of Zelda: Breath of the Wild | Red Dead Redemption 2 | The Last of Us Remastered | Assassin's Creed Odyssey | The Last of Us | The Legend of Zelda: Ocarina of Time 3D | Shadow of the Colossus | The Legend of Zelda: The Wind Waker | Marvel's Spider-Man | Metroid: Samus Returns | The Legend of Zelda: Majora's Mask 3D | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Sports | NFL 2K | Tony Hawk's Pro Skater 4 | Tony Hawk's Pro Skater | NFL 2K1 | NBA 2K2 | Madden NFL 2004 | Madden NFL 2005 | Madden NFL 2003 | World Soccer Winning Eleven 8 International | Tony Hawk's Pro Skater 2 | Tony Hawk's Pro Skater | All-Star Baseball 2001 | NBA 2K1 | Virtua Tennis | FIFA Soccer 12 | SSX Tricky | Rocket League | Rocket League | World Soccer Winning Eleven 7 International | 1080: TenEighty Snowboarding | Championship Manager Season 01/02 | Madden NFL 06 | NFL Blitz | NBA 2K12 | NHL 10 | Tony Hawk's Pro Skater 3 | Let's Golf 3D | Tiger Woods PGA Tour 10 | Mario Golf | NHL 09 | Worldwide Soccer Manager 2006 | FIFA Soccer 10 | NBA 2K17 | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Strategy | Dungeon Keeper | Company of Heroes | Sid Meier's Alpha Centauri | Sid Meier's Civilization IV | Advance Wars | Galactic Civilizations II: Twilight of the Arnor | Sid Meier's Civilization VI | Warcraft III: Reign of Chaos | StarCraft II: Wings of Liberty | Black & White | Age of Empires II: The Age of Kings | Sid Meier's Gettysburg! | Command & Conquer: Red Alert | Warcraft II: Tides of Darkness | Warcraft II: Beyond the Dark Portal | Warcraft III: The Frozen Throne | Command & Conquer Red Alert 2: Yuri's Revenge | Pikmin 2 | Command & Conquer | Sid Meier's Civilization II | Homeworld | World in Conflict | StarCraft: Brood War | Plants vs. Zombies | Rise of Nations: Thrones & Patriots | Medieval: Total War | Cannon Fodder | Shogun 2: Total War | Men of War | Shining Force II | Dragon Force | Advance Wars: Dual Strike | XCOM: Enemy Unknown | Rome: Total War | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Simulation | Jet Coaster Dream 2 | Stardew Valley | Star Wars Rogue Leader: Rogue Squadron II | Star Wars: Rogue Squadron | Space Rangers | Harvest Moon: Sunshine Islands | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| Puzzle | Pac-Man Championship Edition DX | Lumines: Puzzle Fusion | Henry Hatsworth in the Puzzling Adventure | Hanagumi Taisen Columns 2 | Super Monkey Ball | AlphaBounce | Armadillo Run | SpaceChem | World of Goo | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Drama | Hopeful Notes | Le ali della libertà | Eghantham | Maarjaara Oru Kalluvacha Nuna | Fan | National Theatre Live: The Lehman Trilogy | Gini Helida Kathe | Vchera | Delaware Shore | Joshua | C/o Kancharapalem | Oggatonama | National Theatre Live: Angels in America Part ... | Peranbu | Adutha Chodyam |
| Comedy | Vaarthakal Ithuvare | The Moving on Phase | Love in Kilnerry | Innocent | Hababam Sinifi Sinifta Kaldi | None | None | None | None | None | None | None | None | None | None |
| Thriller | Digbhayam | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
| 0 | |
|---|---|
| Role-Playing | 62 |
| Action | 62 |
| Platform | 53 |
| Adventure | 43 |
| Shooter | 66 |
| Racing | 29 |
| Action-Adventure | 11 |
| Sports | 33 |
| Strategy | 34 |
| Simulation | 6 |
| Puzzle | 9 |
| 0 | |
|---|---|
| Drama | 15 |
| Comedy | 5 |
| Thriller | 1 |
È possibile notare come, per i videogiochi, i generi con critiche migliori e tra i generi più pubblicati sono tutti quanti, mentre per i film son solamente 3 generi.
dict_vg_precentage = {}
dict_mv_precentage = {}
for index, row in df_vg_critics.iterrows():
if row['Genre'] in dict_vg:
dict_vg_precentage[row['Genre']] = dict_vg_critics[row['Genre']] / dict_vg[row['Genre']]['Count'].sum() * 100
for index, row in df_mv_critics.iterrows():
if row['genre'] in dict_mv:
dict_mv_precentage[row['genre']] = dict_mv_critics[row['genre']] / dict_mv[row['genre']]['Count'].sum() * 100
display(dict_vg_precentage)
display(dict_mv_precentage)
{'Role-Playing': 1.645872046721529,
'Action': 1.1409642988590356,
'Platform': 2.1183053557154277,
'Adventure': 1.0153482880755607,
'Shooter': 1.9091698004049755,
'Racing': 1.3526119402985073,
'Action-Adventure': 3.6544850498338874,
'Sports': 0.9322033898305085,
'Strategy': 1.1967617036254838,
'Simulation': 0.25762129669386,
'Puzzle': 0.336322869955157}
{'Drama': 0.03886312407700081,
'Comedy': 0.02058375530031699,
'Thriller': 0.009531071292413268}
Nonostante tutto, anche se sono tra i generi più pubblicati, hanno una percentuale molto bassa di votazioni tra 9 e 10. infatti, la percentuale più alta è per i videogiochi di genere Action-Aventure, con il 3.65%.
Si andranno ora ad analizzare le parole più usate nei titoli
parolePiuUsate_mv = pd.Series(' '.join(df_mv['title']).lower().split()).value_counts()[:100]
parolePiuUsate_vg = pd.Series(' '.join(df_vg_noMultiple['Name']).lower().split()).value_counts()[:100]
paroleInComune = parolePiuUsate_mv.index.intersection(parolePiuUsate_vg.index)
fig = go.Figure()
fig.add_trace(go.Bar(x=paroleInComune, y=parolePiuUsate_mv[paroleInComune], name="Movies", marker_color="blue"))
fig.add_trace(go.Bar(x=paroleInComune, y=parolePiuUsate_vg[paroleInComune], name="Video Games", marker_color="red"))
fig.update_layout(title="Parole in comune tra le 100 più usate nei titoli dei film e dei videogiochi", xaxis_title="Parola", yaxis_title="Frequenza")
fig.show()
parolePiuUsate_mv = pd.Series(' '.join(df_mv['title']).lower().split()).value_counts()[:50]
parolePiuUsate_vg = pd.Series(' '.join(df_vg_noMultiple['Name']).lower().split()).value_counts()[:50]
fig = go.Figure()
fig.add_trace(go.Bar(x=parolePiuUsate_mv.index, y=parolePiuUsate_mv, name="Movies", marker_color="blue"))
fig.add_trace(go.Bar(x=parolePiuUsate_vg.index, y=parolePiuUsate_vg, name="Video Games", marker_color="red"))
fig.update_layout(title="50 parole più usate nei titoli dei film e dei videogiochi", xaxis_title="Parola", yaxis_title="Frequenza")
fig.show()
È curioso notare come, per i videogiochi, le parole più usate sono mediamente più lunghe rispetto ai film.